package cn.iocoder.yudao.framework.okhttp.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.convert.DurationStyle;

import java.time.Duration;

/**
 * <p>
 *
 * </p>
 *
 * @author pokbrin
 * @date 2023-07-10 18:00
 */
@Data
@ConfigurationProperties(OkHttpProperties.PREFIX)
public class OkHttpProperties {

    public static final String PREFIX = "zpc.leeks.okhttp";
    private static final Duration D_10_SECONDS = DurationStyle.detectAndParse("PT10S");
    private static final Duration D_5_MINUTE = DurationStyle.detectAndParse("PT15S");


    /**
     * 最大空闲连接数
     */
    private int maxIdleConnections = 20;

    /**
     * 连接的最大空闲时间
     */
    private Duration keepAliveDuration = D_5_MINUTE;

    /**
     * 连接超时时间
     */
    private Duration connectionTimeout = D_10_SECONDS;

    /**
     * 读取超时时间
     */
    private Duration readTimeout = D_10_SECONDS;

    /**
     * 写入超时时间
     */
    private Duration writeTimeout = D_10_SECONDS;



}
